package com.weixin1.service;

import com.weixin1.bean.Photo;
import com.weixin1.dao.PhotoDao;

import java.sql.SQLException;
import java.util.List;

/**
 * 照片的业务层
 */
public class PhotoService {
    private PhotoDao pd=new PhotoDao();

    //查询案例对应的所有图片
    public List<Photo> list() throws SQLException {
        return pd.list();
    }

    //根据照片id查询对应的照片属性
    public Photo getById(Long id) throws SQLException {
        return pd.getById(id);
    }

    //更新
    public boolean save(Photo photo) throws SQLException {
        return pd.save(photo)>0;
    }

    //删除
    public boolean removeById(Long id) throws SQLException {
        return pd.removeById(id)>0;
    }
    //修改
    public boolean update(Photo photo) throws SQLException {
        return pd.update(photo)>0;
    }
    //分页查询
    public List<Photo> selectBypage(int page,int limit) throws SQLException {
        return pd.selectByPage(page,limit);
    }
    //获取总数据长度
    public int gettotal() throws SQLException {
        return pd.gettotal();
    }
}
